import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

main(List<String> args) {
  runApp(Basewhidget());
}

class Basewhidget extends StatelessWidget {
  // statelessWidget 是一个无状态的组件，用于自定义组件

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // materialAPP 是作为根组件使用，定义该页面展示的总体布局
      home: Mybody(),
      theme: ThemeData(
        // 主题
          primarySwatch: Colors.blue // 颜色不能是block ，会报错
      ),
    );
  }
}

class Mybody extends StatelessWidget {


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        decoration: BoxDecoration(
          image: DecorationImage(
//            CachedNetworkImage(imageUrl: 'http://api.btstu.cn/sjbz/?lx=m_dongman&a=1&b=0',fit: BoxFit.cover,)
            // 设置全屏背景图片
            image: NetworkImage(CachedNetworkImage(
              imageUrl: 'http://api.btstu.cn/sjbz/?lx=m_dongman&a=1&b=2',
              fit: BoxFit.cover,).imageUrl),
            fit: BoxFit.cover,
          ),
        ),
        child: ListView(
          children: <Widget>[
            Container(
              height: 300,
//              color: Colors.yellow,
              child: ListView(
                children: <Widget>[
                  Container(

                    height: 100,
//                    color: Colors.blue,
                    child: Row(

                      children: <Widget>[
                        Expanded(
                            flex: 1,
                            child: Card(

                              margin: EdgeInsets.all(20),
                              child: Container(

                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.phone, color: Colors.blueGrey,),
                                  ],
                                ),
                              ),

                            )),
                        Expanded(
                            flex: 1,
                            child: Card(
                              margin: EdgeInsets.all(20),
                              child: Container(
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.message, color: Colors.grey,),
                                  ],
                                ),
                              ),

                            )),
                        Expanded(
                            flex: 1,
                            child: Card(
                              margin: EdgeInsets.all(20),
                              child: Container(
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.contacts, color: Colors.lightGreen,),
                                  ],
                                ),
                              ),

                            )),
                        Expanded(
                            flex: 1,
                            child: Card(
                              margin: EdgeInsets.all(20),
                              child: Container(
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.email, color: Colors.teal,),

                                  ],
                                ),
                              ),

                            )),
                      ],),
                  ),
                  Container(
                    height: 100,
//                    color: Colors.blue,
                    child: Row(

                      children: <Widget>[
                        Expanded(
                            flex: 1,
                            child: Card(

                              margin: EdgeInsets.all(20),
                              child: Container(
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.settings, color: Colors.black26,),

                                  ],
                                ),
                              ),

                            )),
                        Expanded(
                            flex: 1,
                            child: Card(
                              margin: EdgeInsets.all(20),
                              child: Container(
//                                color: Colors.blue,
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.add_a_photo, color: Colors.blueGrey,),
                                  ],
                                ),
                              ),

                            )),
                        Expanded(
                            flex: 1,
                            child: Card(
                              margin: EdgeInsets.all(20),
                              child: Container(
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.music_note, color: Colors.pinkAccent,),
                                  ],
                                ),
                              ),

                            )),
                        Expanded(
                            flex: 1,
                            child: Card(
                              margin: EdgeInsets.all(20),
                              child: Container(
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.explore, color: Colors.lightBlueAccent,),

                                  ],
                                ),
                              ),

                            )),
                      ],),
                  ),
                  Container(
                    height: 100,
//                    color: Colors.blue,
                    child: Row(

                      children: <Widget>[
                        Expanded(
                            flex: 1,
                            child: Card(

                              margin: EdgeInsets.all(20),
                              child: Container(
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.public, color: Colors.teal,),
                                  ],
                                ),
                              ),

                            )),
                        Expanded(
                            flex: 1,
                            child: Card(
                              margin: EdgeInsets.all(20),
                              child: Container(
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.local_grocery_store, color: Colors.yellow,),
                                  ],
                                ),
                              ),

                            )),
                        Expanded(
                            flex: 1,
                            child: Card(
                              margin: EdgeInsets.all(20),
                              child: Container(
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.home, color: Colors.greenAccent,),
                                  ],
                                ),
                              ),

                            )),
                        Expanded(
                            flex: 1,
                            child: Card(
                              margin: EdgeInsets.all(20),
                              child: Container(
                                child: Column(
                                  children: <Widget>[
                                    Divider(color: Colors.white,),
                                    Icon(Icons.archive, color: Colors.blueAccent,),

                                  ],
                                ),
                              ),

                            )),
                      ],),
                  ),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}